13. Searching and pipes (grep, wc)

Searching and pipes (grep, wc)

With the Shell, you can use commands search content in files.

Use the workspace below the video to practice the commands and remember to practice locally in your computer too. You will need to have download dictionary.txt from Downloading (curl) concept

Ud206 016 Shell P10 - Searching And Pipes

Commands

  • grep: "global regular expression print,” processes text line by line and prints any lines which match a specified pattern
  • wc: "short for word count" reads either standard input or a list of files and generates one or more of the following statistics: newline count, word count, and byte count

grep shell dictionary.txt | less

## Workspace

You can use this workspace to test your commands.

Code

If you need a code on the https://github.com/udacity.

Looking for ibo

QUESTION:

How many words are there in dictionary.txt that match the pattern ibo?

SOLUTION:

These answers need to be solved by yourself, I believe you can do it

What are grep patterns called?

QUESTION:

Research question! You can use grep for more than just matching words. There's a specific term for the patterns that grep lets you use.

Use your favorite search engine and do a little research to find out what those patterns are called.

SOLUTION:

These answers need to be solved by yourself, I believe you can do it

Recomendation

The Shell commands can be installed or not on your computer if you are using Linux or Mac and you have issues running the commands check the documentation specifically for the Operating System.